/*******************************************************************************
* * * Copyright (c) 2013 ASEG Inc.  All Rights Reserved
*  *  *
*  *  * This software is the confidential and proprietary information of
*  *  * ASEG Inc. ("Confidential Information").  You shall not
*  *  * disclose such Confidential Information and shall use it only in
*  *  * accordance with the terms of the license agreement you entered into
*  *  * with ASEG Inc.
*  *  *
*  *  * ASEG Inc. MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
*  *  * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
*  *  * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
*  *  * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. ASEG Inc. SHALL NOT
*  *  * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
*  *  * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*  * 
 *  *  * @version     1.0.0
*  *  * @author      Matt Nolan
******************************************************************************/

package org.lionsteins.eddie.server;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
 



public class SessionFactoryUtil {

	 private static final SessionFactory sessionFactory;

	    static {
	        try {
	            // Create the SessionFactory from hibernate.cfg.xml
	        	 sessionFactory = new Configuration()
	             .configure("hibernate.cfg.xml") // give path to hibernate.cfg.xml (recommended)
	             .buildSessionFactory();
	        } catch (Throwable ex) {
	            // Make sure you log the exception, as it might be swallowed
	            System.err.println("Initial SessionFactory creation failed." + ex);
	            throw new ExceptionInInitializerError(ex);
	        }
	    }

	    public static SessionFactory getSessionFactory() {
	        return sessionFactory;
	    }

}